<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<script type="text/javascript" charset="UTF-8" src="<c-rt:url value="/js/yaodian100_mid_soaddr.js"/>"></script>
${pu:reqSet('order', pu:get('com.yaodian100.ec.order.entity.Orders', param.orderId)) }
<style>
.tableAlignLeft td{
	text-align:left;
}
</style>
<h1>
整单退货
</h1>
<script>
function checkForm(){
	var errorMessage="";
	var error=0;	
	$('.reason').each(function(){
		if($(this).attr('value')==''){
			error++;
		}
	});
	if(error>0){
		errorMessage+="请选择退货原因\r\n";
	}
	error=0;
	
	$('.description').each(function(){
		if($(this).attr('value')==''){
			error++;
		}
	});
	if(error>0){
		errorMessage+="请填写退货原因\r\n";
	}
	error=0;

	$('.accessaryDescription').each(function(){
		if($(this).attr('value')==''){
			error++;
		}
	});
	if(error>0){
		errorMessage+="请填写配件赠品状态\r\n";
	}

	if(errorMessage!=''){
		alert(errorMessage);
	}
	else{
		document.returnForm.submit();
	}
}
</script>

<form name="returnForm" method="post" action="/ecadmin/serviceOrder/returnAllProduct.do">
<input type="hidden" name="orderId" id="orderId" value="${order.orderId }"/>
<input type="hidden" name="memberId" value="${order.memberId }"/>
<table class="tb-1 tableAlignLeft">
<thead>
<tr>
	<th>orderProductId</th><th>商品名称</th><th>明细</th><th>退货原因</th><th>退货原因描述</th><th>配件赠品状态</th>
</tr>
</thead>
<tbody>
	<c-rt:forEach items="${order.orderProduct}" var="op">
		<tr>
			<td>${op.orderProdId }<input type="hidden" name="orderProdId" value="${op.orderProdId }"/></td>
			<td>${op.prodName } x ${op.qty }</td>
			<td>
			<c-rt:forEach items="${op.orderProductDetail }" var="od">
				${od.prodName }[${od.prodSpecName }]x${od.qty }<br/>
			</c-rt:forEach>
			</td>
			<td>
			 <select name="reason" class="reason">
	          <option value="">请选择原因</option>
	          <option value="订购错误">订购错误</option>
	          <option value="商品发错">商品发错</option>
	          <option value="商品或外包装破损">商品或外包装破损</option>
	          <option value="商品不如预期">商品不如预期</option>
	          <option value="商品属性不符">商品属性不符</option>
	          <option value="价格比较贵">价格比较贵</option>
	          <option value="与介绍不符">与介绍不符</option>
	          <option value="改买其他款式">改买其他款式</option>
	          <option value="商品未如期收到">商品未如期收到</option>
	          <option value="不会使用">不会使用</option>
	          <option value="其他">其他</option>
	          </select>
			</td>
			<td>
			<textarea name="description" class="description"></textarea>
			</td>
			<td>
			<input class="return-txtfild accessaryDescription" type="text" name="accessaryDescription" value=""/>
			</td>
		</tr>
	</c-rt:forEach>
</tbody>
</table>
<table class="tb-1 tableAlignLeft">
	<tr>
		<th>
		姓名
		</th>
		<td>
		<input type="text" name="receiverName" id="receiverName" value="${order.receiverName }" size="10" />
		</td>
	</tr>
	<tr>
		<th>联络地址</th>
		<td>
		<select id="province" name="receiverProvince" class="c-prov"><option value="">== 选择省 ==</option>
			<c-rt:forEach items="${provincesMap}" var="province" >
				<option value="${province.key}">${province.key}</option>
			</c-rt:forEach>		
		</select> 
              市：<select name="receiverCity" id="city"> 
                <option value="">== 选择城市 ==</option>
              </select> 
              区：<select name="receiverArea" id="district"> 
                <option value="">== 选择地区 ==</option>
              </select> 
              <br /> 
              邮编：<input type="text" name="receiverZip" id="receiverZip" value="${order.receiverZip}"/>
              街道：<input size="50" name="receiverAddr" id="receiverAddr" value="${order.receiverAddr }" /> 
		</td>
	</tr>
	<tr>
		<th>手机电话</th>
		<td><input type="text" name="receiverMobile" id="receiverMobile" value="${order.receiverMobile }" size="10" /></td>
	</tr>
	<tr>
		<th>固定电话</th>
		<td>
			<input type="text" name="receiverPhoneArea" id="receiverPhoneArea" value="${order.receiverPhoneArea }" size="3" />-<input type="text" name="receiverPhone" id="receiverPhone" value="${order.receiverPhone }" size="7" />-分机<input type="text" name="receiverExt" id="receiverExt" value="${order.receiverExt }" size="4" />
		</td>
	</tr>
	<tr>
		<th></th>
		<td>
		<input type="button" value="送出" onclick="checkForm()"/>
		<input type="hidden" value="${order.receiverProvince}" id="receiverProvince"/>
		<input type="hidden" value="${order.receiverCity}" id="receiverCity"/>
		<input type="hidden" value="${order.receiverArea}" id="receiverArea"/>		
		<input type="reset" value="重置"/>
		</td>
	</tr>
</table>
</form>